<template>
    <div>
        <search></search>

        <swipe></swipe>

        <van-grid>
            <van-grid-item v-for="item in catitemsApiData" :icon="item.image_src" :text="item.name" />
             <van-grid-item v-for="item in catitemsApiData" :icon="item.image_src" :text="item.name" />
        </van-grid>
        <div style="width: 100%; height: 60px;" v-show="tSore">
               <div class="seart">
                        <span>京东秒杀倒计时{{ time }}秒</span>
               </div>
        </div>
    </div>
</template>

<script setup>
import Search from '@/components/Search.vue';
import Swipe from '@/components/Swipe.vue';
import { catitemsApi } from '@/api/api'
import { ref } from 'vue';
let timer;
let time =ref(30);
let tSore =ref(true)
timer=setInterval(() => {
       time.value--;
       if(time.value==0){
             clearInterval(time)
             time.value=false
       }
},1000);
let catitemsApiData=ref([])
catitemsApi().then(res=>{
    console.log('导航数据',res);
    catitemsApiData.value=res.data.message
})
</script>

<style lang="scss" scoped></style>